<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>查找记录</title>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/bootstrap-responsive.css" />

    <link rel="stylesheet" href="__PUBLIC__css/public.css">

    <style type="text/css">
    form {
        margin: 0 auto;
        width: 50%;
    }
    </style>
    <style>
    /**内容超出 出现滚动条 **/

    .bui-stdmod-body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    </style>
    <script type="text/javascript">
    function writeObj(obj) {
        var description = "";
        for (var i in obj) {
            var property = obj[i];
            description += i + " = " + property + "\n";
        }
        alert(description);
    }


    //退订
    function unSubProduct(token,productId){
        alert(token,productId);
    }

    function showDlg(data,unsub) {
        var Overlay = BUI.Overlay
        var obj = eval('(' + data + ')');
        writeObj(obj.SubedProducts[0]);
        var content = '<table class="table table-bordered table-hover definewidth m10">';
        content += ` <thead>
            <tr>
                <th>产品名称</th>
                <th>产品id</th>
                <th>价格</th>
                <th>订购时间</th>
                <th>退订时间</th>
                 <th>操作</th>

            </tr>
        </thead>`
        content = content + `<tbody>`;
        var tbody = "<tbody>";
        $.each(obj.SubedProducts, function(index, value, array) {
            var tr = "<tr>";
            tr += "<td>";
            tr += value.productName;
            tr += "</td>";
            tr += "<td>";
            tr += value.productId;
            tr += "</td>";
            tr += "<td>";
            tr += value.price;
            tr += "</td>";
            tr += "<td>";
            tr += value.subTime;
            tr += "</td>";
            tr += "<td>";
            tr += value.unSubTime;
            tr += "</td>";
            if (value.unSubscribeable == true) {
                tr += "<td>";

                tr += '<a href="javascript:unSubProduct(vavalue.productId)" id="unSubProduct">退订</a>';
                tr += "</td>";
            }
            tr += "</tr>";

            content += tr;

        });
        content += "</tbody></table>";
        $('#content').append(content);

        var dialog = new Overlay.Dialog({
            title: '订购详情',
            width: 500,
            height: 250,
            contentId: 'content',
            success: function() {
                alert('确认');
                this.close();
            }
        });
        dialog.show();
    }

    $(function() {　　
        // $("tr").click(function(obj) {　　　　
        //     var data = $(this).attr('data');
        //     var url = $(this).attr('url');
        //     var unsub_url=$(this).attr('unsub');
        //     window.location=url;
        //     // $.ajax({
        //     //     type: "GET",
        //     //     url: url,
        //     //     data: {
        //     //         token: data,
        //     //         datatype: "jsonp"
        //     //     },
        //     //     success: function(obj) {
        //     //         showDlg(obj,unsub_url);
        //     //     }
        //     // });


        // });



    });
    </script>
</head>

<body>
    <form action="{:U('cp/find_')}" method="post" accept-charset="utf-8">
        手机号：
        <input type="text" name="phone">
         <input type="hidden" name="product_type" value="{$product_type}" >
        <input type="submit" value="查找" class="btn btn-primary">
    </form>
    <table class="table table-bordered table-hover definewidth m10">
        <thead>
            <tr>

                <th>usernumber</th>
                <th>msgtype</th>
                <th>spnumber</th>
                <th>渠道号</th>

                <th>时间</th>
                <th>serviceid</th>
                <th>productid</th>
                <th>gateway</th>
                <th>fee</th>

            </tr>
        </thead>
        <tbody>
            <foreach name="data" item="vo">
                <tr >
                    <td>{$vo.usernumber}</td>
                    <td>{$vo.msgtype}</td>
                    <td>{$vo.spnumber}</td>
                    <td>{$vo.mocontent}</td>
                    <td>{$vo.motime}</td>
                    <td>{$vo.serviceid}</td>
                    <td>{$vo.productid}</td>
                    <td>{$vo.gateway}</td>
                    <td>{$vo.fee}</td>

                </tr>

            </foreach>
            <div id="products">
            </div>
        </tbody>
    </table>
    <div id="content" class="hide"></div>
</body>

</html>
